import collections


class Solution(object):
    def minAreaFreeRect(self, points):
        n = len(points)
        d = collections.defaultdict(list)
        for i in range(n):
            for j in range(i + 1, n):
                t = ((points[i][0] + points[j][0]) / 2, (points[i][1] + points[j][1]) / 2,
                     (points[i][1] - points[j][1]) ** 2 + (points[i][0] - points[j][0]) ** 2)
                d[t].append([points[i], points[j]])
        min_s = 0
        for t in d:
            if len(d[t]) >= 2:
                st = d[t]
                for i in range(len(st)):
                    for j in range(i + 1, len(st)):
                        x = ((st[j][0][0] - st[i][0][0]) ** 2 + (st[j][0][1] - st[i][0][1]) ** 2) ** 0.5
                        y = ((st[j][1][0] - st[i][0][0]) ** 2 + (st[j][1][1] - st[i][0][1]) ** 2) ** 0.5
                        if min_s == 0:
                            min_s = x * y
                        else:
                            min_s = min(x * y, min_s)
        return min_s




data = Solution()
points = [[0, 1], [2, 1], [1, 1], [1, 0], [2, 0]]
print(data.minAreaFreeRect(points))
